<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of description
 *
 * @author Chris Sim
 */
 $options = array();
 if(!$update) {
 foreach($models as $model) {
     $ref = $model->do_details_id;
     $options[$ref] = $ref;
 }}
 else {
     $models->our_marking();
 }
?>
<table class="ui-widget-content" style="width:100%;">
    <tr>
        <th class="ui-widget-header"><?php echo CHtml::encode($models[0]->getAttributeLabel('do_details_id')) ?></th>
        <th class="ui-widget-header"><?php echo CHtml::encode($models[0]->getAttributeLabel('marking')) ?></th>
        <th class="ui-widget-header"><?php echo CHtml::encode($models[0]->getAttributeLabel('item')) ?></th>
        <th class="ui-widget-header"><?php echo CHtml::encode($models[0]->getAttributeLabel('qty')) ?></th>
    </tr>
    <?php $count=1; foreach($models as $i=>$model):  ?>
    <tr>
        <td><?php echo CHtml::activeDropDownList($model, "[$i]do_details_id",$options, array('style'=>'width:80px;')); ?></td>
        <td><?php echo CHtml::activeTextField($model, "[$i]marking", array('size'=>10,'maxlength'=>50)); ?></td>
        <td><?php echo CHtml::activeTextArea($model, "[$i]item", array('cols'=>30,'rows'=>2)); ?></td>
        <td><?php echo CHtml::activeTextField($model, "[$i]qty",array('size'=>7,'maxlength'=>10)); ?><?php echo CHtml::activeDropDownList($model, "[$i]qty_type", cargo_details_packing_list::model()->type, array('style'=>'width:80px;')); ?></td>
    </tr>
    <?php $count++; endforeach; ?>
    <?php if($count <=10):for($i=$count;$i<=10;$i++): ?>
    <tr>
        <td><?php echo CHtml::activeDropDownList(cargo_details_packing_list::model(), "[$i]do_details_id",$options, array('style'=>'width:80px;')); ?></td>
        <td><?php echo CHtml::activeTextField(cargo_details_packing_list::model(), "[$i]marking", array('size'=>10,'maxlength'=>50)); ?></td>
        <td><?php echo CHtml::activeTextArea(cargo_details_packing_list::model(), "[$i]item", array('cols'=>30,'rows'=>2)); ?></td>
        <td><?php echo CHtml::activeTextField(cargo_details_packing_list::model(), "[$i]qty",array('size'=>7,'maxlength'=>10)) ?><?php echo CHtml::activeDropDownList(cargo_details_packing_list::model(), "[$i]qty_type", cargo_details_packing_list::model()->type, array('style'=>'width:80px;')); ?></td>
    </tr>
    <?php endfor;endif; ?>
</table>